package com.example.mvp.Ui.Fragment;

import android.view.View;

import com.example.mvp.Model.BaseModel;
import com.example.mvp.Presenter.BasePresenter;
import com.example.mvp.View.BaseView;

public abstract class BaseMvpFragment<V extends BaseView,M extends BaseModel,P extends BasePresenter<V,M>> extends BaseFragment{
 public  P mPresenter;


    @Override
    protected void initData() {
        mPresenter=createPresenter();
        if (mPresenter!=null){
            mPresenter.bindView((V)this);
        }
        initEvent();


    }



    protected abstract void initEvent();


    protected abstract P createPresenter();


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        if (mPresenter!=null){
            mPresenter.destoryView();
            mPresenter=null;
        }
    }
}
